Home Discussion Discuss: Ask SQL Questions Online

  • copy/insert data from one database to anotherthaha June 24, 2011 at 12:54 PM

    Hello guys, I'm new here and kind new on SQL and that's way I want to ask you regarding a query. I need to copy data from Table_1 (Database_1) into Table_2 (Database_2). The structure of both databases are same (I'm referring of the columns that should be inserted). i want to update older data and insert new one in my database_1 from database_2......... plz help

  • How to combine queries into two columnsJohn March 10, 2013 at 3:17 AM

    I want to combine some queries together into one rather than using union possibly. Currently I'm doing something like this select firstname, lastname, 'acc' as 'department' where dept = 'acc' union select firstname, lastname, 'man' as 'department' where dept = 'man' so I get firstname lastname department --------- -------- ---------- john doe acc john doe man is there a way to rewrite this so I can get something like firstname lastname department department2 --------- -------- ---------- ----------- john doe acc man

  • sql questionGeorge Maridakis October 6, 2011 at 4:10 PM

    hello, i am new to sql and I would alike to ask a question. I have two tables . The first one is student(student_name, student_id) and the other is class(class_name,class_id,student_id). what should be the query if i want all student names for those students that attend the most classes. thanks in advance

  • How to retrieve data from database through front eNavin Gupta October 26, 2011 at 2:46 AM

    Hello everyone, I am developing an information based website where a user can get the information through back end. My problem is how to retrieve data from database to front end. A user can enter his categories like for hotels a user can enter name, location, category(3 star,4 star or 5 star)and after submitting the information he will get the required information. The front end will be having textboxes where a user can enter his criteria. Please help me!!!

  • for or while loop usage in sqlravi February 28, 2013 at 10:55 AM

    select @StrName = UserId from productuser where ProductID in ((select ProductID from productassets where AssetID in(select AssetId from course where Title='Programming')) INTERSECT select ProductID from organizationproduct where OrganizationID in (select OrganizationID from organization where OrganizationName='Infosys')) how to use for or while loop in sql query to get first ten values

  • query about mergeronak January 12, 2012 at 2:23 PM

    One master table like Table : employee_master Id name Dep_it location Salary 1 Abc 100 Aa 1000 2 Abc 101 Aa 1000 3 Abc 101 Aa 2000 4 Abc 102 Ab 2000 5 Abc 102 Ab 3000 6 abc 102 Ac 3000 7 abc 103 Ad 4000 We have to maintain SPECIFIED ROWS and SPRCIFIED COLUMNS IN child table up-to-dateâ?¦â?¦always Child table : employee_chield Columns :id,name,dep_it Rows :dep_it in (100,101) Id name Dep_id 1 Abc 100 2 Abc 101 3 Abc 101 Both table reside in different database When either one row or thousands of row are update,insert,delete according to that child tableâ??s data must be managedâ?¦â?¦â?¦. Second we have to maintain log tableâ?¦.. Table name:employee_log Id,status,start_time,end_time,inserts,updates,deletes id status Start_time End_time inserts updates Deletes 1 successfull 10:10:53 10:11:00 20 10 5 2 Unsucessfull: error message 09:01:11 null null null null

  • SQL QueryRyle January 28, 2012 at 12:08 AM

    I'm trying to set up a query to sum a value for each user by month and then calc the percentage of that user's total vs the total month's value. My query below works as long as its limited to one month. I've tried to group my subquery the same as the main but can't figure it out. SELECT Format(FORMHEAD.FH_ENTERED,"yyyy-mm") AS [Month], USERS.UR_NAME AS [User], Count(FORMHEAD.FH_TAGNUM) AS [Num Coils], Sum(FORMHEAD.FH_WEIGHT) AS Weight, Round(Sum(FORMHEAD.FH_WEIGHT)/(SELECT Sum(FH_WEIGHT)FROM FORMHEAD WHERE FH_ENTERED>=#1/1/2012#)*100,1) as PCT FROM USERS INNER JOIN FORMHEAD ON USERS.UR_ID=FORMHEAD.UR_ID WHERE (((FORMHEAD.FH_ENTERED)>=#1/1/2012#)) GROUP BY Format(FORMHEAD.FH_ENTERED,"yyyy-mm"), USERS.UR_NAME ORDER BY Format(FORMHEAD.FH_ENTERED,"yyyy-mm") DESC;

  • SQLRamesh February 1, 2012 at 1:03 PM

    what is the difference between in and exists? when should i use exists and in, i need example also. i read one website when i use in here the sub query will run first after that the outer query gets but exists vice-versa.if the sub query run first means how its identifing the Alias name, so i need a good explanation

  • sql queryray February 13, 2012 at 12:24 PM

    write a query to find out second highest salary and difference between max salary and second highest salary.

  • MutiplyingKhan February 14, 2012 at 4:24 AM

    I have a table named sample8 with the following column names in the following order; price | tax | vat | sale | profit the table has one row with the following values: '9.99','6.78','3.45','22.44','57.12' i wish to multiply all of the values by 1.1 giving me 5 new values. however i am having difficulties doing this; as you can see below only the last column is multiplied by 1.1, i require all the columns to be multiplied yk=> select price,tax,vat,sale,profit * 1.1 from sample8; price | tax | vat | sale | ?column? -------+------+------+-------+---------- 9.99 | 6.78 | 3.45 | 22.44 | 62.832 (1 row) Any help would be really appreciated thanks

  • columns for different valuesenthusesql February 19, 2012 at 2:09 PM

    Dear, I have following data with me date branch inv_no amount 01-jan-2011 A 004 6000 02-jan-2011 B 002 200 31-jan-2010 D 001 15000 31-jan-2010 C 006 10000 31-jan-2010 A 003 9000 31-jan-2010 C 005 15000 and so on... I want an sql statement to count the invoice field based on the amount. The desired result is like this branch count(invoice)>10,000 count(invoice)10000 a 0 3 b 1 0 c 0 2 d .. an d so on I tried to use function Decode, Case but could not be successful. Kindly help me in getting the correct syntax or any other way to find this values by another methods. I have mire than 15000 rows to analyse. Thankf for response in advace.

  • simple question from newbiemegan April 27, 2012 at 3:15 AM

    here are my tables (not all fields shown): employees - id - email emailsent - empid - emailid - datesent I want all the employees.id and also the emailsent.datesent where emailid = 18 but if there is no emailid of 18 then I want to see "not sent" here is what i need: employee.id datesent 1 1/12/2012 2 not sent

  • how to use case when function?Hongyi Lu March 28, 2012 at 5:53 AM

    I have a piece of sql code as following, I want to make sure if it is right or not? select hh_id, case when INCOME_HH in('1') then '1-level_1' when INCOME_HH in('2') then '2-level_2' when INCOME_HH in('3') then '3-level_3' when INCOME_HH in('4') then '4-level_4' when INCOME_HH in('5') then '5-level_5' when INCOME_HH in('6') then '6-level_6' when INCOME_HH in('9') then '9-level_9' end INCOMELEVEL, case when INCOME_EST_HH_HIGHER_RANGES in('A') then '1-range_a' when INCOME_EST_HH_HIGHER_RANGES in('B') then '2-range_b' when INCOME_EST_HH_HIGHER_RANGES in('C') then '3-range_c' when INCOME_EST_HH_HIGHER_RANGES in('D') then '4-range_d' when INCOME_EST_HH_HIGHER_RANGES in('E') then '5-range_e' when INCOME_EST_HH_HIGHER_RANGES in('F') then '6-range_f' when INCOME_EST_HH_HIGHER_RANGES in('G') then '9-range_g' end INCOMERANGE from mce.HH_IB_DEMOGRAPHICS_VW where INCOME_EST_HH_HIGHER_RANGES is not null;

  • SQL LoopAaron April 24, 2012 at 2:19 AM

    I have a calendar table with dates starting from 1/1/2012 and going through 1/1/2025. I need a sql update statement that will allow me to choose a date in this table (1/8/2012) and update a column with either a 1 (week1 of pay period) or a 2 (week 2 of pay period). It needs to loop through to a certain date that I give it to stop at. It should take the 1st 7 days or records, and update to a 1, then switch to a 2 for the next 7 days, and then back to a 1 for the next 7 days and so on.

  • sql querryDineshy Vishe April 30, 2012 at 11:04 AM

    select DATEADD(DD, -2, GETDATE()),112) from Emp

  • SQL STATEMENT IN NETBEANSmanikanta May 15, 2012 at 5:50 PM

    Iam using NETBEANS IDE. Iam developing a bank application. Using JDBC in SERVLETS For the withdraw function, "bal" and "ano" are user inputs when i wrote like, st.executeQuery("UPDATE ACCOUNT SET AMOUNT="+bal+"WHERE ACCOUNTNO="+ano); It's moving to the servlet but not executing. But when writing the same like, st.executeQuery("UPDATE ACCOUNT SET AMOUNT="+bal); It's moving to SERVLET but EVERY ACCOUNT BALANCE is DEDUCTING.... PLZZZZZ HELP ME IN THIS.....

  • SQlpravalika May 28, 2012 at 12:14 PM

    Hi, I have a Database of 8GB i have attached it to SQL and i am not able to purge the DataBase the transaction is rolled back after 4GB of Data is purged and folder is made empty it did not remain at least a part of it. Can i get some code to Purge 8Gb database. Thanks.

  • sql mergingshiva June 12, 2012 at 7:39 AM

    how to merge two database in same machine

  • Problems with group by and headersKurt Hougaard June 23, 2012 at 5:31 AM

    Hi I have a access database with one tabel. I have a column named 'Teacher' and one named 'Student' eg.. - Teacher - - Student - Niels Thomsen Henriette Nielsen Niels Thomsen Sofie Overgaard Niels Thomsen Henrik Jensen Niels Thomsen Hanne Vestergaard Bo Hansen Henry Madsen Bo Hansen Jacob Riis Bo Hansen Torben Mogensen I would like to create a SQL statement that makes it possible to get this output. Niels Thomsen Henriette Nielsen Sofie Overgaard Henrik Jensen Hanne Vestergaard Bo Hansen Henry Madsen Jacob Riis Torben Mogensen

  • sqlpanchal July 4, 2012 at 12:43 PM

    UPDATE tblPatientCustomFormData SET ResultValue= CASE WHEN CustomFormControl_ID=403640 AND ( SELECT ORDTST.PCF_ID FROM tmp_PERMS_5_Cleansing PERMS JOIN tmp_ORDERTEST_YES_Cleansing ORDTST ON PERMS.PAT_ID=ORDTST.PAT_ID) THEN ' ' WHEN CustomFormControl_ID=403643 AND ( SELECT ORDTST.PCF_ID FROM tmp_PERMS_5_Cleansing PERMS JOIN tmp_ORDERTEST_YES_Cleansing ORDTST ON PERMS.PAT_ID=ORDTST.PAT_ID)THEN 'NO' ELSE ResultValue End throwitg error, whats solution?

  • SQL QUERYJEEVAN July 19, 2012 at 12:32 AM

    SELECT A.BUSINESS_UNIT,A.PROJECT_ID,B.PROJECT_USER2 IDRBU,B.PROJECT_USER1 IDRPO,A.ACTIVITY_ID, NVL((SELECT SUM(FOREIGN_AMOUNT)FROM PS_PROJ_RESOURCE WHERE BUSINESS_UNIT=A.BUSINESS_UNIT AND PROJECT_ID=A.PROJECT_ID AND ACTIVITY_ID=A.ACTIVITY_ID AND ANALYSIS_TYPE IN ('BP1','BPA','BAJ')),0)BUDGET WHAT IS WRONG WITH THIS???? HELP WILL B APPREICATED IF U EXPLAIN THE CODE

  • access problemguest September 19, 2012 at 2:24 AM

    i have ubuntu12.04 host os.In this i install oracle virtual box.Also i have install mysql . in virtual box i have install again ubuntu12.04. now i want to access mysql of host os from guest os. how to do it. thanks

  • MS Sql query questionSally October 31, 2012 at 7:03 PM

    Hello, I have to tables as below. I want write a MS SQL query which will return clients that do exists in the tenants table. Please advice. My query should return Sally Hope only, as she does not have client ID in the Tenants table. Clients Client_ID Forename Surname 1 peter brook 2 Sally hope 3 steve clarke Tenants Tenants_ID Client_ID Unit town 20 1 55 Enfield 30 2 66 Herts

  • how can i add range for copying db to n otherAwais November 14, 2012 at 10:51 AM

    Hi, i dont know whos going to get my message but im sure n expert will answer me.. im working in office where we use a software to transmit the info from one sever to n other server. the db we use is SQL ver8 to replicate date from my local server to national server we use distribution agent > publication. the problem is that if i dont run this with in 24 hr it will expire and the date wont be send to national server. so we use query on national server and that is ---------------------------------- SP_SERVEROPTION 'IMOLETTER', 'DATA ACCESS', 'TRUE' SP_COPY_LOC_TO_NAT_DB 'IMOLETTER', 'IPS4Db' ----------------------------------- where imoletter is my local office and ips4db is the national server. my question is that there is a previous date of 2 months pending. but when i run this query it will start sending the data from the beginning and it took lot of time to do that like my db is more then 5 gb. i just want to add date range for example send the data starting from oct 2012 to till now.. that will save my time and data will be submitted in no time. hope you get me fully..a if there is any option to add date range please let me know it will really ease my work and i will be grateful to you for my whole life. thanks

  • SQL JDavies December 1, 2012 at 6:59 AM

    Basically i have a view that has car models and counts insurance policies. I need to display the Car model with the most policies. The view works fine, if i say select MAX(Counter) as MaxC from Details I get the most policies, i need the model next to it, so i tryed select MAX(Counter) as MaxC from Details where C_model = (select C_model from Details where C_model = Max(Counter) ) PLEASE HELP ME! I have been working on this for hours. regards joe

  • combine sql result into single python dcitionaryrafiq mohammad April 24, 2013 at 12:09 PM

    I have sql query like "select col_name from tbl_name" which i am running from a python program the result is a list of dictionaries like below [{'poll_addr': '1.1.1.19'}, {'poll_addr': '10.6.2.161'} but i need the result in the following format with single key and all result combined with a comma [{'poll_addr': '192.166.55.111,192.167.50.127'}], i do not want to do this in python as the query result is too large count

  • SQL GRANT Privilege to More than OneHDC June 8, 2013 at 3:25 AM

    GRANT INSERT ON (I need to grant the user privileges to BOTH orders & orderline. Do I begin: GRANT INSERT ON orders.orderline? OR GRANT INSERT ON orders (orderline)? OR make em separate commands? or what? it is unclear. And then of course go on to TO ...blah blah blah AND MUST GRANT blahblahblah & TO blahblahblah BE on SEPARATE LINES? OR CAN IT ALL BE ON ONE LINE?

  • SELECT 2nd and 3rd row in TOP 3Juulius August 5, 2013 at 5:15 AM

    Hi guys... i'm currently developing a news-site. So here is the problem. I want to select the 2nd and 3rd row in a TOP 3. SELECT TOP 3 * FROM News ORDER BY Date DESC; I want to remove the 1st row and only return the 2nd and 3rd row. Can anyone help?

  • SQL CASE STATEMENTNalin November 17, 2013 at 9:13 AM

    I have a table in Oracle DB withe order count and unique IDs as columns: Order Count ID 2 1 3 2 4 4 4 5 11 6 20 8 35 9 19 12 Now I want to get a count of IDs grouped by order and separated into different buckets. For e.g. all the orders that have value <= 10 ,I need to separate the order bucket by "1" and all the orders that have value >10 and <100 I need to separate the order bucket by 10. The output for above table should be: Count(ID) Order 1 2 1 3 2 4 3 11-20 0 21-30 1 31-40 I don't want to use case statement since I have a lot of such bucket based on which I need to group the data. Please suggest how can I write the SQL query.

  • sql ravi January 30, 2012 at 6:16 PM

    hi, I want to disply the max salaries from 2 tables data.pls send answer to me.

  • sqlkamal January 21, 2013 at 12:29 PM

    hi, first time i want to show all the data from table (eg.kamal table name)...in that i give "yes" for some fields...if i open second time at the same table i want to show only "non yes" fields...how should write a query in sql...plz help...

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
General

Ask SQL Questions Online
Ask SQL Questions Online       Structured Query Language in short (SQL... and new database. SQL query is the most widely used database query as most 

General

Ask Hibernate Questions Online
Ask Hibernate Questions Online   .... Feel free to ask questions on Hibernate related problems. In the move... programming questions. You can ask about the error's you are facing in your 

SQL Question

sql
sql  I want interview sql questions   Please visit the following link: SQL Tutorials 

General

Ask Programming Questions Online
Ask Programming Questions Online   ..., Spring questions, Dojo questions, iBatis questions, DBMS questions, SQL questions.... So, feel free and post Java questions, JSP questions, Servlet questions, EJB 

Programming Questions

Software Questions and Answers
; View Software Questions and Answers online Discuss Software development questions, ask your questions and get answers online. Here you can... programming problems. Ask Questions | Browse Latest Questions 

General

Ask iBatis Questions Online
Ask iBatis Questions Online   ... question using our new service ‘Ask iBatis Questions Online’ and get... and persistence API that automates the mapping between SQL databases and objects 

SQL Question

Sql Interview questions? - SQL
Sql Interview questions?  Define join?when will use join? define Inner join? give the example? and when will use inner join? define outer join...://www.roseindia.net/sql/sqljoin/index.shtml Hope that it will be helpful for you 

Programming Questions

Software Questions and Answers
online Discuss Software development questions, ask your questions and get answers online. Here you can find questions asked by developers in the past. You can... of answers to common programming problems. Ask Questions | Browse 

SQL Question

Online exam using c# and SQL server
Online exam using c# and SQL server  hello, i'm making the (window based)online examination system using C#.net and SQL SERVER. my database is stored on server. my question is: if during the examination server gets failed 

Java Beginners

online quiz
online quiz  Define a Question class which stores a multiple choice... of up to 10 questions. Define the add method of the Quiz class to add a question... approach to populates a quiz, presents it by asking questions randomly 

Java Magazine Questions

online quiz
online quiz  Define a Question class which stores a multiple choice... of up to 10 questions. Define the add method of the Quiz class to add a question... approach to populates a quiz, presents it by asking questions randomly 

Design concepts & design patterns Questions

online quiz
online quiz  Define a Question class which stores a multiple choice... of up to 10 questions. Define the add method of the Quiz class to add a question... approach to populates a quiz, presents it by asking questions randomly 

Java Interview Questions

online quiz
online quiz  Define a Question class which stores a multiple choice... of up to 10 questions. Define the add method of the Quiz class to add a question... approach to populates a quiz, presents it by asking questions randomly 

Java Beginners

online quiz
online quiz  Define a Question class which stores a multiple choice... of up to 10 questions. Define the add method of the Quiz class to add a question... approach to populates a quiz, presents it by asking questions randomly 

Java Beginners

online quiz
online quiz  Define a Question class which stores a multiple choice... of up to 10 questions. Define the add method of the Quiz class to add a question... approach to populates a quiz, presents it by asking questions randomly 

General

Ask MySQL Questions online
Ask MySQL Questions online   ... initiated a new service ‘Ask Questions on MySQL’. Now you are free to ask... Language (SQL) Database Implementation used in creating static to dynamic website 

General

Ask DBMS Questions online
Ask DBMS Questions online   ..., Structure Query Language (SQL), Sybase, Ingres, Ask any questions... is the Structured Query Language (SQL 

WebSevices Questions

online exam portal
online exam portal  i am thinking of developing a small online exam pattern with multipe choice questions , can u please give me any idea of how to start 

JSP Servlet Questions

Online performance system
Online performance system  hi m developing Online performance... be created by the system , by automatically selecting the questions from database... an online test thanks vinoy 

JSP Servlet Questions

jsp online exam
jsp online exam  i have designed a html page with 20 multiple choice questions ...options are in radio button for each question .... now i have to retrieve all the selected answers and save it to database match it with correct 

Struts Questions

online shopping project
online shopping project  can you plz send the source code of online shopping application developed with the help of struts 1.2, hibernate and sql , jsp   Please visit the following link: Struts Shopping Cart 

JSP Servlet Questions

Java project in online examination system
Java project in online examination system  how many and which tables are required at backend as SQL for online examination system project in jsp 

JSP Servlet Questions

online examination system project in jsp
online examination system project in jsp  How many tables are required in SQL for online examination system project in jsp in java 

JSP Servlet Questions

online examination system project in jsp
online examination system project in jsp  How many tables are required in SQL for online examination system project in jsp in java my email id 

JSP Servlet Questions

online examination system project in jsp
online examination system project in jsp  thanks for providing me 6 tables for online examination system. I want to know what will the id field of Answers1 table contain? Will it contain same id for all the questions of Set1 & 

JSP Servlet Questions

online examination system project in jsp
online examination system project in jsp  thanks for providing me 6 tables for online examination system. I want to know what will the id field of Answers1 table contain? Will it contain same id for all the questions of Set1 & 

JavaScript Questions

JAVASCRIPT FOR ONLINE QUIZ
JAVASCRIPT FOR ONLINE QUIZ  i m creating a set of online questionnaire consist of 12 questions with choice of answers from 0-6.i've done creating... want to use get element by id function to read the score.if any questions 

EJB Questions

Online Examination System
Online Examination System  Hi.. I have to create a Online Examination system using struts, Hibernate and stateful session beans.. I Wanna know... to add/edit/delete questions and users. System should be able to provide proper 

Programming Tutorials

SQL
SQL       SQL SQL is an English like language consisting of commands to store, retrieve, maintain & regulate access to your database. SQL*Plus SQL*Plus 

General

Ask Java Questions Online
Ask Java Questions Online   ... is everywhere! View and ask questions at http... Developer Company has just begun a new service ‘ask question online&rsquo 

DMCA.com