Know Your Current Username in MySQL

Chandu yadav
Updated on 30-Jul-2019 22:30:24

8K+ Views

Yes, you can use the method CURRENT_USER() to know the current username in MySQL.The above method returns the username that can be used to authenticate the client connection.The query is as follows −mysql> select CURRENT_USER();The following is the output −+----------------+ | CURRENT_USER() | +----------------+ | root@% | +----------------+ 1 row in set (0.00 sec)Or you can use USER() method from MySQL. The query is as follows −mysql> select user();Here is the output −+----------------+ | user() | +----------------+ | root@localhost | +----------------+ 1 row in set (0.00 sec)

Get Primary Key of a Table in MySQL

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:24

4K+ Views

To get the primary key of a table, you can use the show command. The syntax is as follows −SHOW INDEX FROM yourDatebaseName.yourTableName WHERE Key_name = 'PRIMARY';Suppose, we have a table with two primary keys; one of them is “Id” and second is “RollNum". The query for a table is as follows −mysql> create table TwoOrMorePrimary    −> (    −> Id int,    −> Name varchar(200),    −> RollNum int    −> ,    −> Primary key(Id, Age)    −> ); Query OK, 0 rows affected (0.85 sec)Apply the above syntax to get primary key of a table. ... Read More

Frame the Report of an Event Conducted in College

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

405 Views

Report writing is a part of academic writing. It is an informational work, such as writing, speech, made with the intention of providing information or recounting events in a presentable form, such that it can be published in a magazine or newspaper.Steps to Write A Report for A College Event Held PreviouslyGather Facts - This is the most extensive and the laborious part. You must know the inside-out phenomena, e.g. who was the chief guest, what was the exact time when the valediction ceremony was conducted. Never keep the facts in your mind, as you might forget in stress and ... Read More

Update Column Size in MySQL

Rishi Rathor
Updated on 30-Jul-2019 22:30:24

394 Views

To update the column size, you can use alter command. The syntax is as follows −alter table yourTableName change yourColumnName yourColumnName data type;To understand the above syntax, let us create a table. The query to create a table −mysql> create table DataTruncated −> ( −> id int, −> Name varchar(5) −> ); Query OK, 0 rows affected (0.64 sec)Look at the column ‘Name’ above, the column size is 5. Whenever we will give the size greater than 5 then MySQL gives the following error −mysql> ... Read More

Is Simplicity an Inspiration for Writing

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

162 Views

“Life is not complex. We are complex. Life is simple, and the simple thing is the right thing.” — Oscar Wilde.When I read such amazing quotations about simplicity, I feel like step out and explore the meaning and vastness of simplicity. In fact, William Hazlitt in his prose piece, On familiar style is scornful of the writers whose writing style is pedantic, with affectation and pretense, showy and gaudy, and thus it lacks a familiar style and even common sense too.How Can It Be Achieved?Simplicity can only be harvested from within, through hard work, engagement, and insight. This is even ... Read More

Get String Representation of Current File Object in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

224 Views

The string representation of the current file object can be obtained using the method java.io.File.toString(). This method returns the abstract path name in the string form.A program that demonstrates this is given as follows −Example Live Demoimport java.io.File; public class Demo {    public static void main(String[] args) {       File file = new File("C:" + File.separator + "jdk11.0.2" + File.separator, "demo1.java");       System.out.println("File: " + file.toString());    } }The output of the above program is as follows −OutputFile: C:/jdk11.0.2/demo1.javaNow let us understand the above program.The abstract path name is printed in the string form using the ... Read More

Implement Ternary Conditional Operator in MySQL

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

3K+ Views

A ternary conditional operator looks like ?: in programming language like C, C++, Java etc. The syntax is as follows −(yourCondition) ? statement1:statement2;In the above syntax, if yourCondition becomes true then statement1 will evaluate and if yourCondition becomes false then statement2 will evaluate.But the above syntax does not work in MySQL. We can use IF() function from MySQL for the same purpose.Let us see an example −Case 1mysql> select if(3 > 5, 'Condition is true', 'Condition is not true') as ConditionalResult;The following is the output in which second statement evaluates since is 3 isn’t more than 5 −+-----------------------+ | ConditionalResult ... Read More

New English Words You Have Learned Today

Aakanghsa
Updated on 30-Jul-2019 22:30:24

299 Views

Ragtag: A group of people perceived as disreputable or undesirable.Lynch: (of a mob) kill (someone), especially by hanging, for an alleged offence with or without a legal trial.Gimcrack: A cheap and showy ornament; a knickknack or flimsy or poorly made but deceptively attractive.Vogie: Conceited, proud, cheerfulCarte Blanche: Unconditional authority; full discretionary power.Tummler: Any lively, prankish, or mischievous man.Hoity-Toity: Assuming airs; pretentious; haughty.Magisterial: Authoritative, weighty; of importance or consequence; of, relating to, or befitting a master: a magisterial pronouncement by the director of the board.Coeval: Of the same age, date, or duration; equally old: Analysis has proved that this manuscript is ... Read More

How FM Radio Set Works

Knowledge base
Updated on 30-Jul-2019 22:30:24

1K+ Views

The FM receiver is the whole unit which takes the modulated signal as input and outputs the original audio signal. Radio amateurs are the initial radio receivers. They had got drawbacks such as poor sensitivity and selectivity.Selectivity is the selection of a particular signal while rejecting the others. Sensitivity is the capacity of detecting RF signal and demodulating it, while at the lowest power level. Both Selectivity and Sensitivity should be high for an FM receiver. To overcome these drawbacks of the ordinary receiver, the superheterodyne receiver was invented. This FM receiver consists of 5 main stages.RF Tuner SectionThe modulated ... Read More

Counting Chars in EditText Changed Listener in Android

Chandu yadav
Updated on 30-Jul-2019 22:30:24

1K+ Views

Some situations, we have to restrict an edit text for some characters. To solve this situation, in this example demonstrate how to Counting Chars in Edit Text Changed Listener.Step 1 - Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 - Add the following code to res/layout/activity_main.xml.     In the above code, we have taken one edit text. It going to check the length of the entered characters, if it exceeds 5 then it shows an error message.Step 3 - Add the following ... Read More

Advertisements