Home Database Mysql Tutorial 根据二度人脉推荐好友sql

根据二度人脉推荐好友sql

Jun 07, 2016 pm 03:59 PM
d Friend sql friends recommend structure

friend表结构 DROP TABLE IF EXISTS FRIEND; create table friend( uid bigint not null comment '用户标识', friend_uid bigint not null comment '申请加为好友的用户标识', sys_create_date datetime not null comment '申请时间', sys_last_update datet

friend表结构

DROP TABLE IF EXISTS FRIEND;
create table friend(
uid bigint not null comment '用户标识',
friend_uid bigint not null comment '申请加为好友的用户标识',
sys_create_date datetime not null comment '申请时间',
sys_last_update datetime not null comment '更新时间',
state tinyint not null comment '好友状态 0 : 删除, 1:申请好友, 2 : 好友',
primary key(uid, friend_uid)
)ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '好友表';

select friend_uid from

friend where state=2 and
uid in (select friend_uid from friend where uid=13 and state=2)

and friend_uid not in (select friend_uid from friend where uid=13 ) and friend_uid != 13 limit 6

uid为当前用户的ID,为id为13的用户查询二度人脉好友

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the difference between HQL and SQL in Hibernate framework? What is the difference between HQL and SQL in Hibernate framework? Apr 17, 2024 pm 02:57 PM

HQL and SQL are compared in the Hibernate framework: HQL (1. Object-oriented syntax, 2. Database-independent queries, 3. Type safety), while SQL directly operates the database (1. Database-independent standards, 2. Complex executable queries and data manipulation).

How to retrieve deleted WeChat friends How to retrieve deleted WeChat friends How to retrieve deleted WeChat friends How to retrieve deleted WeChat friends Feb 22, 2024 pm 05:52 PM

In the add friend option of WeChat, enter the other party's WeChat ID and click Add. Tutorial Applicable Model: iPhone13 System: iOS15.3.1 Version: WeChat 8.0.19 Analysis 1 First, click the plus icon in the upper right corner of the WeChat homepage. 2 Then click Add Friends in the pop-up options. 3. Then enter the add friend page and enter the other party’s WeChat ID. 4After searching for the friend, click Add to Address Book to add the friend. Supplement: How to delete WeChat friends 1. First open and log in to WeChat, click on the address book at the bottom of the WeChat main page. 2Click to enter the homepage of the friend you want to delete, and click the three dots icon in the upper right corner of the page. 3 Enter the profile settings and click the delete option at the bottom of the page to delete friends. Summary/Precautions What are the friends deleted by WeChat?

Usage of division operation in Oracle SQL Usage of division operation in Oracle SQL Mar 10, 2024 pm 03:06 PM

"Usage of Division Operation in OracleSQL" In OracleSQL, division operation is one of the common mathematical operations. During data query and processing, division operations can help us calculate the ratio between fields or derive the logical relationship between specific values. This article will introduce the usage of division operation in OracleSQL and provide specific code examples. 1. Two ways of division operations in OracleSQL In OracleSQL, division operations can be performed in two different ways.

How do I know if the other party has deleted me on WeChat - How to determine whether I have been deleted by a friend How do I know if the other party has deleted me on WeChat - How to determine whether I have been deleted by a friend Mar 18, 2024 pm 07:58 PM

WeChat is one of the most popular social applications currently, and friend management is an inevitable part of daily use. Sometimes, we may be curious whether certain friends have deleted us, but we don’t want to ask directly or cause embarrassment. Below, the editor has compiled 4 methods to check whether WeChat friends have deleted you. Let’s take a look! Method 1. Send a message directly The simplest and most direct method is to try to send a message to the other party. If the other party has deleted you, WeChat will prompt "The other party has turned on friend verification, and you are not his (her) friend yet. Please send a friend verification request first, and you can only chat after the other party has passed the verification." Method 2: Initiate a video or voice call Trying to initiate a video or voice call to the other party is also an effective method. If the other party has deleted you, the call will

Comparison and differences of SQL syntax between Oracle and DB2 Comparison and differences of SQL syntax between Oracle and DB2 Mar 11, 2024 pm 12:09 PM

Oracle and DB2 are two commonly used relational database management systems, each of which has its own unique SQL syntax and characteristics. This article will compare and differ between the SQL syntax of Oracle and DB2, and provide specific code examples. Database connection In Oracle, use the following statement to connect to the database: CONNECTusername/password@database. In DB2, the statement to connect to the database is as follows: CONNECTTOdataba

What does the identity attribute in SQL mean? What does the identity attribute in SQL mean? Feb 19, 2024 am 11:24 AM

What is Identity in SQL? Specific code examples are needed. In SQL, Identity is a special data type used to generate auto-incrementing numbers. It is often used to uniquely identify each row of data in a table. The Identity column is often used in conjunction with the primary key column to ensure that each record has a unique identifier. This article will detail how to use Identity and some practical code examples. The basic way to use Identity is to use Identit when creating a table.

How to recommend friends to me on Taobao How to recommend friends to me on Taobao Feb 29, 2024 pm 07:07 PM

In the process of using Taobao, we will often be recommended by some friends we may know. Here is an introduction to how to turn off this function. Friends who are interested should take a look. After opening the "Taobao" APP on your mobile phone, click "My Taobao" in the lower right corner of the page to enter the personal center page, and then click the "Settings" function in the upper right corner to enter the settings page. 2. After coming to the settings page, find "Privacy" and click on this item to enter. 3. There is a "Recommend friends to me" on the privacy page. When it shows that the current status is "on", click on it to close it. 4. Finally, in the pop-up window, there will be a switch button behind "Recommend friends to me". Click on it to set the button to gray.

How to retrieve deleted WeChat friends How to add deleted WeChat friends back How to retrieve deleted WeChat friends How to add deleted WeChat friends back Feb 22, 2024 pm 03:30 PM

You can search for the other party's WeChat ID on the add friend interface to retrieve it. Tutorial Applicable Model: iPhone13 System: iOS15.5 Version: WeChat 8.0.19 Analysis 1 Click the plus button in the upper right corner of the WeChat main interface. 2 Then click the Add Friend option in the pop-up window. 3 Next, enter the friend’s WeChat ID in the pop-up Add Friend page. 4. After finally searching for the friend, click Add to Address Book. Supplement: How to delete WeChat friends 1. First open WeChat and click on the address book at the bottom of the home page. 2 Then click on the friend you want to delete in the address book. 3Then click the three-dot button in the upper right corner of the details page. 4 Next, click the Delete option on the pop-up page. 5Finally, click Delete Contact. Summary/Notes

See all articles