Skip to main content

Posts

Showing posts with the label select

How to separate string from email id in SQL

To separate string from email id in SQL you can try below query. seperate ' test' '@' 'xyz'   ' com'   from test@xyz.com SELECT SUBSTR(mailID, 1, INSTR(mailID, '@', 1, 1)-1) String1, SUBSTR(mailID, INSTR(mailID, '@', 1, 1), 1) String2, SUBSTR(mailID, INSTR(mailID, '@', 1, 1)+1, INSTR(mailID, '.', 1, 1)-INSTR(mailID, '@', 1, 1)-1) String3, SUBSTR(mailID, INSTR(mailID, '.', 1, 1)+1) String4 FROM ( SELECT '&MailID' mailID FROM Dual );

How to learn Microsoft Paint and 3D paint faster | Learn Paint in Hindi and English

You can learn  Microsoft Paint and 3D paint faster after watching this video. I hope you will like share and subscribe this video to get more updates, English version video. Hindi Version Video.

Difference between view and Materialized view and Define Long Column

Difference between view and Materialized view  (i) View will not store any data,whereas Materialized View will store data. (ii)View is used for security purpose and Materialized View for performance. (iii) view is not accessible if base table is dropped, whereas in Materialized View it can still be accessible. (iv) Can perform DML operation directly on view but it Materialized View its not possible. Define Long Column LONG columns cannot be in the SELECT clause when using the UNION set operators. There are some restrictions for long columns like.  (i) It cannot appear in where clause. (ii) Indexes cannot be created on them. (iii) It cannot appear in Group by,order by, or connect by clauses or with the distinct operator in select statements.

How to find distinct from number of list in string

How to find distinct from number of list in string in SQL Solution: SELECT LTRIM(H,',') OUTPUT FROM (SELECT sys_connect_by_path(K,',') H, L val FROM (SELECT K, ROW_NUMBER() OVER (ORDER BY K) L FROM (SELECT UNIQUE TO_NUMBER(REPLACE(SUBSTR(G,1,INSTR(G,',',1)),',','')) K FROM (SELECT B, J, A, (LTRIM(SUBSTR(A,B,J),',')) G FROM ( SELECT DISTINCT b, LEAD(b)over (order by b ASC) j, A FROM (SELECT instr(a,',',level)b, A FROM (SELECT ('1,2,0,2,432,445,3,3,-1,10099,-2,0.32,0.3432,.3432,4,4,5,6,0.32,-2,432,32,21029,10099,3209839') ||',' a FROM dual ) CONNECT BY level <=LENGTH(A)+1 ORDER BY b ) ) WHERE B<>J ORDER BY B ) ORDER BY 1 ) ORDER BY K ) WHERE connect_by_isleaf=1 START WITH L =1 CONNECT BY L = prior L+1 );

How to Set Default Limit in Store Procedure in SQL

This is stored procedure which show you rows return as per mention in stored procedure. CREATE PROCEDURE get_categories( IN p_action_flag VARCHAR(50), IN p_firstrow int, IN p_lastrow int) BEGIN IF p_action_flag = 'all' THEN SELECT top 50 u.*, d.name, d.image FROM user u, member gu, detail d WHERE u.user_id = gu.user_id AND u.user_id = d.user_id AND u.status = '1' AND gu.group_id IN (1, 7) GROUP BY u.user_id ORDER BY d.name LIMIT p_firstrow,p_lastrow; ELSEIF p_action_flag = 'Most Viewed' THEN SELECT top 50 u.*, d.name, d.image FROM user u, member gu, detail d WHERE u.user_id = gu.user_id AND u.user_id = d.user_id AND u.status = '1' AND gu.group_id IN (1, 7) GROUP BY u.user_id ORDER BY u.views DESC, d.name ASC LIMIT p_firstrow,p_lastrow ; END IF END