Skip to content
Advertisement

Tag: mysql

Importing certain columns from csv into mysql via command line

I have a csv file and want to import part of it into my Mysql database. From this question, I tried this command in my Mysql command line Those in bracket is the columns I want to put in my table. The order is same to my table but not same to csv file. And the mysql didn’t do anything

SQL Query Confused

Display: account no. customer id initial amount in terms of lakhs (rounded off to 2 decimals) [change the column heading to ‘INITIALAMTIN_LAKHS’] amount category(amt < 50000 show as 'Low', amt > …

java.sql.SQLException: Geometry byte string must be little endian

I want to use the contains function to get all values whose title or question contains a certain value. However, I get this error: java.sql.SQLException: Geometry byte string must be little endian. at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120) at com.mysql.jdbc.MysqlIO.nextRowFast(MysqlIO.java:2076) at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1932) at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:3426) at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:488) at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:3131) at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2299) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2722) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2794) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2322) at SQL.Select.getRecentQuestions(Select.java:447) at org.apache.jsp.Questions_jsp._jspService(Questions_jsp.java:198)

How to do division in SQL query between two column

In the above image I have 4 column and I am trying to get the average value of criticality and Priority by dividing it by the totalNumber. But for some reason my query is not working and I also trying to just get one decimal place after the division. My sql query: Answer Try to use cast(round(criticality/totalNumber,1) as numeric(36,1)) for

Order by SQL line

How would I go about creating an SQL line that puts each car from new to old (Years) but also keeps it in alphabetical order For example it needs to do this This is how its displaying MY View Answer You may try the following query: The call I make to SUBSTRING_INDEX extracts the second word from the model string.

how does ‘ ‘ i.e single quote space single quote work in sql?

I observed that this query returns all values from the database. Why is that? Answer This query: Would not be valid in most databases. Some interfaces concatenate adjacent strings, so this is interpreted as: The two wildcards are the same as one. This will match every non-NULL value. If you want to find emails with a space, then correct logic

Advertisement