Articles on Trending Technologies

Technical articles with clear explanations and examples

How can we add multiple columns, with single command, to an existing MySQL table?

Rama Giri
Rama Giri
Updated on 20-Jun-2020 8K+ Views

We can also add multiple columns to an existing table with the help of ALTER command. The syntax for it would be as follows −SyntaxAlter table table-name ADD (column-name1 datatype, column-name2 datatype,… column-nameN datatype);ExampleIn the example below, with the help of ALTER Command, columns ‘Address’, ‘Phone’ and ‘Email’ are added to the table ‘Student’.mysql> Alter Table Student ADD(Address Varchar(25), Phone INT, Email Varchar(20)); Query OK, 5 rows affected (0.38 sec) Records: 5 Duplicates: 0 Warnings: 0

Read More

Use of different files in SAP HANA Cockpit for offline administration

SAP Developer
SAP Developer
Updated on 19-Jun-2020 252 Views

Start, Restart, Stop System Operations: To perform start/stop/restart of HANA systemDiagnosis Files: This is used to access log, trace and other diagnosis files.Troubleshoot Unresponsive System: You can use this to trigger the collection of transactional information and displays this information for troubleshooting performance issues.SAP HANA Documentation - SAP HANA Offline Administration: You can open SAP HANA documentation that describes those administration tasks that you can perform using the SAP HANA cockpit for offline administrationSAP HANA Cockpit: This option is used to open SAP HANA cockpit where you can access all applications for the online administration of SAP HANA system.

Read More

Date and Time Functions in DBMS

David Meador
David Meador
Updated on 19-Jun-2020 6K+ Views

The date and time functions in DBMS are quite useful to manipulate and store values related to date and time.The different date and time functions are as follows −ADDDATE(DATE, DAYS)The numbers of days in integer form (DAYS) is added to the specified date. This is the value returned by the function. For example −sql> SELECT ADDDATE('2018-08-01', 31); +---------------------------------------------------------+ | DATE_ADD('2018-08-01', INTERVAL 31 DAY)                 | +---------------------------------------------------------+ | 2018-09-01                                             | +---------------------------------------------------------+ 1 ...

Read More

SELECT Statement and its Clauses in DBMS

David Meador
David Meador
Updated on 19-Jun-2020 5K+ Views

The select statement is used to get the required data from the database according to the conditions, if any. This data is returned in the form of a table.The basic syntax of the select statement is −Select column 1, column 2 ... column N From table_nameAn example of the select statement is −Student_NumberStudent_NameStudent_PhoneStudent_MarksStudent_MajorSubject1Andrew661592728495Literature2Sara658365486565Maths3Harry464756746348Literature4Sally653783708430Literature5Anne745733773288MathsQuery −Select Student_Name From StudentThis query yields the following result −Student_NameAndrewSaraHarrySallyAnneClauses in Select statementThe example of select statement given above is quite simple and not that useful in practice. So, there are many other clauses associated with select statement that make it more meaningful. Some of these are ...

Read More

How is it possible to store date such as February 30 in a MySQL date column?

Ankitha Reddy
Ankitha Reddy
Updated on 19-Jun-2020 248 Views

Suppose we want to store the date such as February 30 in a MySQL table then we must have to first set ALLOW_INVALID_DATES mode enabled.For example, I am trying to add, without enabling ALLOW_INVALID_DATES mode, such kind of date in a table then MySQL will give an error as follows −mysql> Insert into date_testing(date) values('2017-02-30'); ERROR 1292 (22007): Incorrect date value: '2017-02-30' for column 'Date' at row1Now we need to enable ALLOW_INVALID_DATES mode enabled as follows −mysql> SET sql_mode = 'ALLOW_INVALID_DATES'; Query OK, 0 rows affected (0.00 sec) mysql> Insert into date_testing(date) values('2017-02-30'); Query OK, 1 row affected (0.14 ...

Read More

What are the different unit values that can be used with MySQL INTERVAL keyword?

Smita Kapse
Smita Kapse
Updated on 19-Jun-2020 200 Views

Different unit values which can be used with MySQL INTERVAL keyword are as follows −MICROSECONDThis unit will be used for adding or subtracting the number of specified microseconds from the current time or as provided by the user.mysql> Select NOW()+INTERVAL 100 MICROSECOND +--------------------------------+ | NOW()+INTERVAL 100 MICROSECOND | +--------------------------------+ | 2017-10-28 18:47:25.000100     | +--------------------------------+ 1 row in set (0.00 sec)Above query will add 100 microseconds to the current date & time with the help of MySQL INTERVAL keyword.mysql> Select '2017-02-25 05:04:30' + INTERVAL 100 Microsecond; +--------------------------------------------------+ | '2017-02-25 05:04:30' + INTERVAL 100 Microsecond | +--------------------------------------------------+ | ...

Read More

How can I insert the values in columns without specifying the names of the column in MySQL INSERT INTO statement?

Kumar Varma
Kumar Varma
Updated on 19-Jun-2020 3K+ Views

For inserting the values in the column without specifying the names of the columns in INSERT INTO statement, we must give the number of values that matches the number of columns in the table along with taking care about the data type of that column too.ExampleIn the example below we have inserted the values without specifying the name of the column.mysql> Insert into student values(100, 'Gaurav', 'Ph.D'); Query OK, 1 row affected (0.08 sec) mysql> Select * from student; +--------+--------+--------+ | RollNO | Name   | Class  | +--------+--------+--------+ | 100    | Gaurav | Ph.D   | +--------+--------+--------+ ...

Read More

How can we insert current date and time automatically on inserting values in other columns in MySQL?

varun
varun
Updated on 19-Jun-2020 2K+ Views

In MySQL, we can insert the current date and time automatically to a column on inserting the values in another column by declaring that column as DEFAULT CURRENT_TIMESTAMP.Examplemysql> Create table testing    -> (    -> StudentName varchar(20) NOT NULL,    -> RegDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP    -> ); Query OK, 0 rows affected (0.49 sec)Above query will create a table ‘testing’ with a column named StudentName and other column named ‘RegDate’ declared as DEFAULT CURRENT_TIMESTAMP. Now, on inserting the values i.e. names in StudentName column, the current date and time will be inserted in the other column automatically.mysql> Insert ...

Read More

How to add columns to an existing MySQL table?

Monica Mona
Monica Mona
Updated on 19-Jun-2020 607 Views

By using ALTER command we can add columns to an existing table.SyntaxAlter table table-name ADD (column-name datatype);Example In the example below, with the help of ALTER Command, column ‘GRADE’ is added to the table ‘Student’.mysql> Alter table Student ADD (Grade Varchar(10)); Query OK, 5 rows affected (1.05 sec) Records: 5 Duplicates: 0 Warnings: 0

Read More

What are the different commands used in MySQL?

Chandu yadav
Chandu yadav
Updated on 19-Jun-2020 4K+ Views

SQL language is divided into four types of primary language statements: DML, DDL, DCL and TCL. Using these statements, we can define the structure of a database by creating and altering database objects and we can manipulate data in a table through updates or deletions. We also can control which user can read/write data or manage transactions to create a single unit of work.The four main categories of SQL statements are as follows −DML (Data Manipulation Language)DML statements affect records in a table. These are basic operations we perform on data such as selecting a few records from a table, ...

Read More
Showing 53741–53750 of 61,297 articles
Advertisements