V Jyothi

V Jyothi

54 Articles Published

Articles by V Jyothi

Page 5 of 6

How can we set up a MySQL User account by using INSERT INTO statement?

V Jyothi
V Jyothi
Updated on 20-Jun-2020 2K+ Views

For adding a new user to MySQL, we just need to add a new entry to the user table in the database mysql. To illustrate it we are using the following example −ExampleThe following program is an example of adding a new user guest with SELECT, INSERT and UPDATE privileges with the password guest123; the SQL query is −root@host# mysql -u root -p Enter password:******* mysql> use mysql; Database changed mysql> INSERT INTO user (host, user, password, select_priv, insert_priv, update_priv) VALUES ('localhost', 'guest', PASSWORD('guest123'), 'Y', 'Y’, 'Y'); Query OK, 1 row affected (0.20 sec) mysql> FLUSH PRIVILEGES; Query OK, ...

Read More

How can I check the list of MySQL tables, in the current database we are using, along with table type in the result set?

V Jyothi
V Jyothi
Updated on 20-Jun-2020 199 Views

It can be done with the SHOW FULL TABLES statement. Its Syntax would be as follows −SyntaxSHOW FULL TABLESExampleIn the following example our current database is ‘query’ hence the statement below will show us the table list along with table type in the result set from this database −mysql> SHOW FULL TABLES; +-----------------------------+------------+ | Tables_in_query             | Table_type | +-----------------------------+------------+ | accounts                    | BASE TABLE | | address                     | BASE TABLE | | cars     ...

Read More

What kinds of programs are available in MySQL database to manage MySQL server?

V Jyothi
V Jyothi
Updated on 20-Jun-2020 262 Views

MySQL database provides us the following programs as administrative tools to manage MySQL server −mysqldIt is also known as MySQL server daemon. It is the main program that does most of the work in a MySQL installation. We need to use ‘mysqld’ to start our MySQL server. It is having many options that can be specified at the time of startup.mysqladminProcessing Re-write Suggestions Done (Unique Article)Basically ‘mysqladmin’ could be a client for playacting administrative operations. we are able to use it to see the server’s configuration and current status, to create and drop databases, and plenty of a lot of.For ...

Read More

How can I create a table and insert values in that table using prepare statements?

V Jyothi
V Jyothi
Updated on 20-Jun-2020 238 Views

It can be understood with the help of following the example in which we have created the table named ‘Student’ by using prepared statement −mysql> PREPARE stmt3 FROM 'CREATE TABLE Student(Id INT, Name Varchar(20))'; Query OK, 0 rows affected (0.00 sec) Statement prepared mysql> EXECUTE stmt3; Query OK, 0 rows affected (0.73 sec) mysql> DEALLOCATE PREPARE stmt3; Query OK, 0 rows affected (0.00 sec)Now, with the help of following queries using prepared statements, we can insert the valuesin table ‘Student’ −mysql> PREPARE stmt7 FROM 'INSERT INTO Student(Id, Name) values(?, ?)'; Query OK, 0 rows affected (0.00 sec) Statement ...

Read More

How can we check the character set of all the tables in a particular MySQL database?

V Jyothi
V Jyothi
Updated on 20-Jun-2020 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 ...

Read More

How to apply EXTRACT() function with WHERE Clause on the dates stored in MySQL table?

V Jyothi
V Jyothi
Updated on 27-Feb-2020 1K+ Views

With the help of following MySQL query, we can apply EXTRACT() function with WHERE clause on the dates stored in a table.mysql> Select StudentName,EXTRACT(Year from dateofreg)AS YEAR from testing WHERE StudentName = 'Gaurav'; +-------------+------+ | StudentName | YEAR | +-------------+------+ | Gaurav | 2017 | +-------------+------+ 1 row in set (0.00 sec)

Read More

Can we define a class inside a Java interface?

V Jyothi
V Jyothi
Updated on 20-Feb-2020 7K+ Views

Yes, you can define a class inside an interface. In general, if the methods of the interface use this class and if we are not using it anywhere else we will declare a class within an interface.Exampleinterface Library { void issueBook(Book b); void retrieveBook(Book b); public class Book { int bookId; String bookName; int issueDate; int returnDate; } } public class Sample implements Library ...

Read More

How to find package explorer in Java eclipse project?

V Jyothi
V Jyothi
Updated on 20-Feb-2020 25K+ Views

To view the project explorer, click on Window menu then, click on Show View and select Project Explorer.There is simpler way to open project explorer, when you are in the editor press alt + shift + w and select project explorer.

Read More

Cast string to date in specific format in SAP HANA

V Jyothi
V Jyothi
Updated on 14-Feb-2020 2K+ Views

I think you just need to use ‘TO_VARCHAR’ and ‘TO_DATE’ functions.SELECT TO_VARCHAR(TO_DATE(, 'YYYYMMDD'), 'YYYY-MM-DD') FROM

Read More

How to get the first day of next month in MySQL?

V Jyothi
V Jyothi
Updated on 29-Jan-2020 1K+ Views

With the help of following MySQL query, we can get the first day of next month −mysql> SELECT DATE_FORMAT(CURDATE() + INTERVAL 1 MONTH,'%Y-%m-01') AS 'FIRST DAY OF NEXT MONTH'; +-------------------------+ | FIRST DAY OF NEXT MONTH | +-------------------------+ | 2017-11-01              | +-------------------------+ 1 row in set (0.00 sec)

Read More
Showing 41–50 of 54 articles
Advertisements